    package net.minecraft.src;

    public class mod_AsPj extends BaseModMp //Note It extends basemod (part of modloader) not block
    {

       public static final Block conductiveLampActive; 
       public static final Block conductiveLampIdle;
       public static final Block blockTransmiterIdle;
       public static final Block blockTransmiterPowered;
       public static final Block blockReceiverActive;
       public static final Block blockReceiverIdle;
       public static final Block blockSequencerIdle;
       public static final Block blockSequencerActive;  
       public static final Block blockSynchronousSequencer;
       public static final Block blockController;
       
       
       public static int sequencerBack;
       public static int sequencerUp;
       public static int sequencerDown;
 
       public static int synchronousSequencerBack;
       public static int synchronousSequencerUp;
       public static int synchronousSequencerDown;

       public static int controllerUp;
       public static int controllerDown;
       
       public  TileEntityRecTransStampRenderer  recTrans = new TileEntityRecTransStampRenderer();
       
       public static final int  baseId  = 204;
       public static final int  clientnetId  = 204;
       public static final int  serverGuiId  = 104; 
       
       public static final int  idReceiverPacket = 1;
       public static final int  idTransmiterPacket = 2;
       public static final int  idSequencerPacket = 3;
       public static final int  idSequencerSliderPacket = 4;
       static
       {   
           conductiveLampActive = (new BlockConductiveLamp(ReadIdFile.getIdFromFile(BlockConductiveLamp.class),  ModLoader.addOverride("/terrain.png", "/mod/conductiveLampActive.png"), true)).setHardness(0.2F).setLightValue(1.0F).setStepSound(Block.soundGlassFootstep).setBlockName("conductiveLampActive").setRequiresSelfNotify();
           conductiveLampIdle = (new BlockConductiveLamp(ReadIdFile.getIdFromFile(BlockConductiveLamp.class) + 1, ModLoader.addOverride("/terrain.png", "/mod/conductiveLampIdle.png"), false)).setHardness(0.2F).setLightValue(0.0F).setStepSound(Block.soundGlassFootstep).setBlockName("conductiveLampIdle").setRequiresSelfNotify();          
           blockTransmiterIdle = (new BlockTransmiter(ReadIdFile.getIdFromFile(BlockTransmiter.class), ModLoader.addOverride("/terrain.png", "/mod/blockTransmiter.png"),false)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockTransmiter").setRequiresSelfNotify();   
           blockTransmiterPowered = (new BlockTransmiter(ReadIdFile.getIdFromFile(BlockTransmiter.class)+1, ModLoader.addOverride("/terrain.png", "/mod/blockTransmiterPowered.png"),true)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockTransmiter").setRequiresSelfNotify(); 
           blockReceiverActive = (new BlockReceiver(ReadIdFile.getIdFromFile(BlockReceiver.class), ModLoader.addOverride("/terrain.png", "/mod/blockReceiverActive.png"),true)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockReceiverActive").setRequiresSelfNotify(); 
           blockReceiverIdle = (new BlockReceiver(ReadIdFile.getIdFromFile(BlockReceiver.class)+1, ModLoader.addOverride("/terrain.png", "/mod/blockReceiver.png"),false)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockReceiverIdle").setRequiresSelfNotify(); 
           blockSequencerIdle = (new BlockSequencer(ReadIdFile.getIdFromFile(BlockSequencer.class), ModLoader.addOverride("/terrain.png", "/mod/blockSequencer.png"),false)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockSequencerIdle").setRequiresSelfNotify(); 
           blockSequencerActive = (new BlockSequencer(ReadIdFile.getIdFromFile(BlockSequencer.class)+1, ModLoader.addOverride("/terrain.png", "/mod/blockSequencerActive.png"),true)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockSequencerActive").setRequiresSelfNotify(); 
           blockSynchronousSequencer = (new BlockSynchronousSequencer(ReadIdFile.getIdFromFile(BlockSynchronousSequencer.class), ModLoader.addOverride("/terrain.png", "/mod/synchronousSequencerSide.png"))).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockSynchronousSequencer").setRequiresSelfNotify(); 
           blockController = (new BlockController(ReadIdFile.getIdFromFile(BlockController.class), ModLoader.addOverride("/terrain.png", "/mod/blockController.png"),true)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setBlockName("blockController").setRequiresSelfNotify();  
       }                    

       public mod_AsPj()
       {
    	   
    	  ModLoader.registerTileEntity(TileSequenzer.class, "tileSequenzer"); 
    	  ModLoader.registerTileEntity(TileSynchronousSequencer.class, "tileSynchronousSequencer"); 
    	  ModLoader.registerTileEntity(TileRecTransStamp.class, "tileReceiverTransmiter",recTrans); 
    	  ModLoader.registerTileEntity(TileTransmiterStamp.class, "tileTransmiter",recTrans); 
    	  ModLoader.registerTileEntity(TileController.class, "tileController"); 
    	  
    	  
    	  ModLoaderMp.registerGUI(this, serverGuiId);

          ModLoader.registerBlock(conductiveLampIdle);
          ModLoader.registerBlock(conductiveLampActive);
          ModLoader.registerBlock(blockTransmiterIdle);
          ModLoader.registerBlock(blockTransmiterPowered);
          ModLoader.registerBlock(blockReceiverActive);
          ModLoader.registerBlock(blockReceiverIdle);
          ModLoader.registerBlock(blockSequencerIdle);
          ModLoader.registerBlock(blockSequencerActive);
          ModLoader.registerBlock(blockSynchronousSequencer);
          ModLoader.registerBlock(blockController);
          
          sequencerBack = ModLoader.addOverride("/terrain.png", "/mod/sequencerPlug.png");
          sequencerUp = ModLoader.addOverride("/terrain.png", "/mod/sequencerUp.png");
          sequencerDown = ModLoader.addOverride("/terrain.png", "/mod/sequencerDown.png");  
         
          
          
          synchronousSequencerBack = ModLoader.addOverride("/terrain.png", "/mod/synchronousSequencerPlug.png");
          /*  synchronousSequencerUp = ModLoader.addOverride("/terrain.png", "/mod/synchronousSequencerUp.png");
          synchronousSequencerDown = ModLoader.addOverride("/terrain.png", "/mod/synchronousSequencerDown.png");
          */
          controllerUp = ModLoader.addOverride("/terrain.png", "/mod/blockControllerDown.png");
          controllerDown = ModLoader.addOverride("/terrain.png", "/mod/blockControllerUp.png");
          
          
          ModLoader.addName(conductiveLampActive, "Conductive Lamp");  
          ModLoader.addName(conductiveLampIdle, "Conductive Lamp"); 
          ModLoader.addName(blockTransmiterIdle, "Transmitter");
          ModLoader.addName(blockTransmiterPowered, "Transmitter");
          ModLoader.addName(blockReceiverActive, "Receiver");
          ModLoader.addName(blockReceiverIdle, "Receiver");
          ModLoader.addName(blockSequencerIdle, "Sequencer");
          ModLoader.addName(blockSequencerActive, "Sequencer");      
          ModLoader.addName(blockSynchronousSequencer, "Synchronous Sequencer");  
          ModLoader.addName(blockController, "Controller");  
          
          ModLoaderMp.registerGUI(this, serverGuiId);
          

       
          ModLoader.addRecipe(new ItemStack(mod_AsPj.conductiveLampIdle, 1), new Object[] {
        	  "RDR", Character.valueOf('D'), Block.redstoneLampIdle, Character.valueOf('R'), Item.redstone
       } );  
 
          ModLoader.addRecipe(new ItemStack(mod_AsPj.blockTransmiterIdle, 1), new Object[] {
        	  " P ", "PRP", "RSR", Character.valueOf('S'), Block.stone, Character.valueOf('P'), Block.planks, Character.valueOf('R'), Item.redstone
       } );  
          
          ModLoader.addRecipe(new ItemStack(mod_AsPj.blockReceiverIdle, 1), new Object[] {
        	  "RPR", "PRP", " S ", Character.valueOf('S'), Block.stone, Character.valueOf('P'), Block.planks, Character.valueOf('R'), Item.redstone
       } ); 
                    
          ModLoader.addRecipe(new ItemStack(mod_AsPj.blockSequencerIdle, 1), new Object[] {
        	  " S ", "IRI", "XSX", Character.valueOf('S'), Block.stone, Character.valueOf('I'), Item.ingotIron,Character.valueOf('X'), Item.redstoneRepeater, Character.valueOf('R'), Item.redstone
       } );

          ModLoader.addRecipe(new ItemStack(mod_AsPj.blockSynchronousSequencer, 1), new Object[] {
        	  " X ", "IRI", " S ", Character.valueOf('S'), Block.stone, Character.valueOf('I'), Item.ingotIron,Character.valueOf('X'), Item.redstoneRepeater, Character.valueOf('R'), Item.redstone
       } );               

          ModLoader.addRecipe(new ItemStack(mod_AsPj.blockController, 1), new Object[] {
        	  " X ", "XRX", " S ", Character.valueOf('S'), Block.stone,Character.valueOf('X'), Item.redstoneRepeater, Character.valueOf('R'), Item.redstone
       } );   
    }

    public GuiScreen handleGUI(int inventoryType) 
    {
    	if(inventoryType == serverGuiId)
    	{
    		TileSequenzer  sequencerTile= (TileSequenzer)ModLoader.getMinecraftInstance().theWorld.getBlockTileEntity(
    			ModLoader.getMinecraftInstance().objectMouseOver.blockX, ModLoader.getMinecraftInstance().objectMouseOver.blockY, ModLoader.getMinecraftInstance().objectMouseOver.blockZ);

              return new GuiSequenzer(ModLoader.getMinecraftInstance().thePlayer.inventory,sequencerTile);
    	} 
    	else 
        	  return null;
    }

       
       public void handlePacket(Packet230ModLoader packet)
       {
    	   World  world  = ModLoader.getMinecraftInstance().theWorld;
               switch(packet.packetType)
               {
                       case idReceiverPacket:
                    	   TileReceiverTransmitterCommon tileReceiverTransmiter = (TileReceiverTransmitterCommon)world.getBlockTileEntity(packet.dataInt[0], packet.dataInt[1], packet.dataInt[2]);
                    	   if(null == tileReceiverTransmiter)
                    		   return;
                    	   tileReceiverTransmiter.loadFromPacket(packet);
                    	   break;
              	   
                       case idSequencerPacket:
                    	   
                    	   TileSequenzer tileSequencer = (TileSequenzer)world.getBlockTileEntity(packet.dataInt[0], packet.dataInt[1], packet.dataInt[2]);
                    	   if(null == tileSequencer)
                    		   return;
                    	   
                    	   tileSequencer.loadFromPacket(packet);							
                    	   break;
               }

       }    

       
    public String getVersion() {
            // TODO Auto-generated method stub
            return null;
    }

   
    public void load() {
            // TODO Auto-generated method stub
            
    }
   
       public String Version()
       {
          return "1.1.0";
       }
    }